use wanmesh_common::error::ErrorBacktrace;

#[derive(thiserror::Error, Debug)]
#[error("{source}\n{backtrace}")]
pub struct DbErr {
    pub source: sea_orm::DbErr,
    pub backtrace: ErrorBacktrace,
}

impl From<sea_orm::DbErr> for DbErr {
    fn from(source: sea_orm::DbErr) -> Self {
        Self {
            source,
            backtrace: Default::default()
        }
    }
}